/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.informet.ipd.modelo.dao;

import com.informet.ipd.modelo.vo.FisiMetaVO;
import com.informet.ipd.modelo.vo.FisiMetaMVO;

import java.math.BigDecimal;
import java.sql.Statement;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;

import javax.swing.JOptionPane;

/**
 *
 * @author LAPTOP01
 */
public class FisiMetaDao extends DBase {

    Connection conn = null;

    public FisiMetaDao() {
   super();
    }



    private void setFisiMeta(FisiMetaVO bean, ResultSet rs) throws SQLException {
        bean.setNUM_CODFISIMETA_PK(rs.getInt("NUM_CODFISIMETA_PK"));
        bean.setNUM_CODMETAAPER_PK(rs.getInt("NUM_CODMETAAPER_PK"));
        bean.setTX_TIPOFISIMETA(rs.getInt("TX_TIPOFISIMETA"));
        bean.setNUM_MES1FISIMETA(rs.getDouble("NUM_MES1FISIMETA"));
        bean.setNUM_MES2FISIMETA(rs.getDouble("NUM_MES2FISIMETA"));
        bean.setNUM_MES3FISIMETA(rs.getDouble("NUM_MES3FISIMETA"));
        bean.setNUM_MES4FISIMETA(rs.getDouble("NUM_MES4FISIMETA"));
        bean.setNUM_MES5FISIMETA(rs.getDouble("NUM_MES5FISIMETA"));
        bean.setNUM_MES6FISIMETA(rs.getDouble("NUM_MES6FISIMETA"));
        bean.setNUM_MES7FISIMETA(rs.getDouble("NUM_MES7FISIMETA"));
        bean.setNUM_MES8FISIMETA(rs.getDouble("NUM_MES8FISIMETA"));
        bean.setNUM_MES9FISIMETA(rs.getDouble("NUM_MES9FISIMETA"));
        bean.setNUM_MES10FISIMETA(rs.getDouble("NUM_MES10FISIMETA"));
        bean.setNUM_MES11FISIMETA(rs.getDouble("NUM_MES11FISIMETA"));
        bean.setNUM_MES12FISIMETA(rs.getDouble("NUM_MES12FISIMETA"));
        
        //bean.setTotal(rs.getDouble("total"));
    }

    private void setMuestraF(FisiMetaVO bean, ResultSet rs) throws SQLException {
        bean.setNUM_CODFISIMETA_PK(rs.getInt("NUM_CODFISIMETA_PK"));
        //bean.setTotal(rs.getDouble("total"));
    }

    private void setMuestraFM(FisiMetaVO bean, ResultSet rs) throws SQLException {
        bean.setNUM_CODFISIMETA_PK(rs.getInt("NUM_CODFISIMETAM_PK"));
    }

    private void setFisiMeta1(FisiMetaVO bean, ResultSet rs) throws SQLException {
    	bean.setNUM_CODMETAAPER_PK(rs.getInt("NUM_CODMETAAPER_PK"));
        bean.setNUM_CODFISIMETA_PK(rs.getInt("NUM_CODFISIMETA_PK"));
        bean.setTX_TIPOFISIMETA(rs.getInt("TX_TIPOFISIMETA"));
        bean.setNUM_MES1FISIMETA(rs.getDouble("NUM_MES1FISIMETA"));
        bean.setNUM_MES2FISIMETA(rs.getDouble("NUM_MES2FISIMETA"));
        bean.setNUM_MES3FISIMETA(rs.getDouble("NUM_MES3FISIMETA"));
        bean.setNUM_MES4FISIMETA(rs.getDouble("NUM_MES4FISIMETA"));
        bean.setNUM_MES5FISIMETA(rs.getDouble("NUM_MES5FISIMETA"));
        bean.setNUM_MES6FISIMETA(rs.getDouble("NUM_MES6FISIMETA"));
        bean.setNUM_MES7FISIMETA(rs.getDouble("NUM_MES7FISIMETA"));
        bean.setNUM_MES8FISIMETA(rs.getDouble("NUM_MES8FISIMETA"));
        bean.setNUM_MES9FISIMETA(rs.getDouble("NUM_MES9FISIMETA"));
        bean.setNUM_MES10FISIMETA(rs.getDouble("NUM_MES10FISIMETA"));
        bean.setNUM_MES11FISIMETA(rs.getDouble("NUM_MES11FISIMETA"));
        bean.setNUM_MES12FISIMETA(rs.getDouble("NUM_MES12FISIMETA"));
        //bean.setTotal(rs.getDouble("total"));
        bean.setMayor(rs.getDouble("mayor"));
    }


    private void setFisiMeta2(FisiMetaMVO bean, ResultSet rs) throws SQLException {
    	bean.setNUM_CODMETAAPER_PK(rs.getInt("NUM_CODMETAAPER_PK"));
        bean.setNUM_CODFISIMETAM_PK(rs.getInt("NUM_CODFISIMETAM_PK"));
        bean.setTX_TIPOFISIMETAM(rs.getInt("TX_TIPOFISIMETAM"));
        bean.setNUM_MES1FISIMETAM(rs.getDouble("NUM_MES1FISIMETAM"));
        bean.setNUM_MES2FISIMETAM(rs.getDouble("NUM_MES2FISIMETAM"));
        bean.setNUM_MES3FISIMETAM(rs.getDouble("NUM_MES3FISIMETAM"));
        bean.setNUM_MES4FISIMETAM(rs.getDouble("NUM_MES4FISIMETAM"));
        bean.setNUM_MES5FISIMETAM(rs.getDouble("NUM_MES5FISIMETAM"));
        bean.setNUM_MES6FISIMETAM(rs.getDouble("NUM_MES6FISIMETAM"));
        bean.setNUM_MES7FISIMETAM(rs.getDouble("NUM_MES7FISIMETAM"));
        bean.setNUM_MES8FISIMETAM(rs.getDouble("NUM_MES8FISIMETAM"));
        bean.setNUM_MES9FISIMETAM(rs.getDouble("NUM_MES9FISIMETAM"));
        bean.setNUM_MES10FISIMETAM(rs.getDouble("NUM_MES10FISIMETAM"));
        bean.setNUM_MES11FISIMETAM(rs.getDouble("NUM_MES11FISIMETAM"));
        bean.setNUM_MES12FISIMETAM(rs.getDouble("NUM_MES12FISIMETAM"));
        //bean.setTotal(rs.getDouble("total"));
        bean.setMayor(rs.getDouble("mayor"));
    }


    
    /*private void setFisiMeta2(FisiMetaVO bean, ResultSet rs) throws SQLException {
    	bean.setNUM_CODMETAAPER_PK(rs.getInt("NUM_CODMETAAPER_PK"));
        bean.setNUM_CODFISIMETA_PK(rs.getInt("NUM_CODFISIMETA_PK"));
        bean.setCOD_TIPOFISIMETA_PK(rs.getInt("COD_TIPOFISIMETA_PK"));
        bean.setNUM_MES1FISIMETA(rs.getDouble("NUM_MES1FISIMETA"));
        bean.setNUM_MES2FISIMETA(rs.getDouble("NUM_MES2FISIMETA"));
        bean.setNUM_MES3FISIMETA(rs.getDouble("NUM_MES3FISIMETA"));
        bean.setNUM_MES4FISIMETA(rs.getDouble("NUM_MES4FISIMETA"));
        bean.setNUM_MES5FISIMETA(rs.getDouble("NUM_MES5FISIMETA"));
        bean.setNUM_MES6FISIMETA(rs.getDouble("NUM_MES6FISIMETA"));
        bean.setNUM_MES7FISIMETA(rs.getDouble("NUM_MES7FISIMETA"));
        bean.setNUM_MES8FISIMETA(rs.getDouble("NUM_MES8FISIMETA"));
        bean.setNUM_MES9FISIMETA(rs.getDouble("NUM_MES9FISIMETA"));
        bean.setNUM_MES10FISIMETA(rs.getDouble("NUM_MES10FISIMETA"));
        bean.setNUM_MES11FISIMETA(rs.getDouble("NUM_MES11FISIMETA"));
        bean.setNUM_MES12FISIMETA(rs.getDouble("NUM_MES12FISIMETA"));
        bean.setMayor(rs.getDouble("mayor"));
    }*/


    public String spMan(int tipo,FisiMetaVO bean) {



String msj = "";
        //JOptionPane.showMessageDialog(null, bean.getTX_TIPOFISIMETA());
        try {
            conn = DriverManager.getConnection(url, usuario, password);
            CallableStatement cs = conn.prepareCall("{call manFisiMeta(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}");
            cs.setInt(1, tipo);
            cs.setInt(2, bean.getNUM_CODFISIMETA_PK());
            cs.setInt(3, bean.getTX_TIPOFISIMETA());
            cs.setDouble(4, bean.getNUM_MES1FISIMETA());
            cs.setDouble(5, bean.getNUM_MES2FISIMETA());
            cs.setDouble(6, bean.getNUM_MES3FISIMETA());
            cs.setDouble(7, bean.getNUM_MES4FISIMETA());
            cs.setDouble(8, bean.getNUM_MES5FISIMETA());
            cs.setDouble(9, bean.getNUM_MES6FISIMETA());
            cs.setDouble(10, bean.getNUM_MES7FISIMETA());
            cs.setDouble(11, bean.getNUM_MES8FISIMETA());
            cs.setDouble(12, bean.getNUM_MES9FISIMETA());
            cs.setDouble(13, bean.getNUM_MES10FISIMETA());
            cs.setDouble(14, bean.getNUM_MES11FISIMETA());
            cs.setDouble(15, bean.getNUM_MES12FISIMETA());
            cs.setDouble(16, bean.getNUM_CODMETAAPER_PK());
            cs.execute();
        } catch (Exception e) {
       JOptionPane.showMessageDialog(null, e.toString());
            return msj;
        }
        return msj;
    }



    public String spManM(int tipo,FisiMetaMVO bean) {



String msj = "";
        //JOptionPane.showMessageDialog(null, bean.getTX_TIPOFISIMETA());
        try {
            conn = DriverManager.getConnection(url, usuario, password);
            CallableStatement cs = conn.prepareCall("{call manFisiMetaM(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}");
            cs.setInt(1, tipo);
            cs.setInt(2, bean.getNUM_CODFISIMETAM_PK());
            cs.setInt(3, bean.getTX_TIPOFISIMETAM());
            cs.setDouble(4, bean.getNUM_MES1FISIMETAM());
            cs.setDouble(5, bean.getNUM_MES2FISIMETAM());
            cs.setDouble(6, bean.getNUM_MES3FISIMETAM());
            cs.setDouble(7, bean.getNUM_MES4FISIMETAM());
            cs.setDouble(8, bean.getNUM_MES5FISIMETAM());
            cs.setDouble(9, bean.getNUM_MES6FISIMETAM());
            cs.setDouble(10, bean.getNUM_MES7FISIMETAM());
            cs.setDouble(11, bean.getNUM_MES8FISIMETAM());
            cs.setDouble(12, bean.getNUM_MES9FISIMETAM());
            cs.setDouble(13, bean.getNUM_MES10FISIMETAM());
            cs.setDouble(14, bean.getNUM_MES11FISIMETAM());
            cs.setDouble(15, bean.getNUM_MES12FISIMETAM());
            cs.setDouble(16, bean.getNUM_CODMETAAPER_PK());
            cs.execute();
        } catch (Exception e) {
       JOptionPane.showMessageDialog(null, e.toString());
            return msj;
        }
        return msj;
    }

    /*public ArrayList<FisiMetaVO> selectLista() throws SQLException {

        Statement stmt = null;
        ResultSet rs = null;
        ArrayList<OEstrategicoVO> lista = new ArrayList<OEstrategicoVO>(0);
        //lista=null;
        String sql = "";
        try {
            conn = DriverManager.getConnection(url, usuario, password);
            stmt = conn.createStatement();
            sql = "select NUM_CODOBJ_PK,TX_DESCOBJ from ME_OBJ";
            rs = stmt.executeQuery(sql);
            OEstrategicoVO bean = null;
            while (rs.next()) {
                bean = new OEstrategicoVO();
                setOEstrategico(bean, rs);
                lista.add(bean);
            }

        } finally {
            if (rs != null) {
                rs.close();
                rs = null;
            }
            if (stmt != null) {
                stmt.close();
                stmt = null;
            }
            if (conn != null) {
                conn.close();
                conn = null;
            }

        }
        return lista;
    }*/

    public List getlist() throws SQLException {

        Statement stmt = null;
        ResultSet rs = null;
        ArrayList<FisiMetaVO> lista = new ArrayList<FisiMetaVO>(0);
        //lista=null;
        String sql = "";
        try {
            conn = DriverManager.getConnection(url, usuario, password);
            stmt = conn.createStatement();
            sql = "select NUM_CODFISIMETA_PK,NUM_CODMETAAPER_PK,TX_TIPOFISIMETA," +
            
            
          
            
            
                    "NUM_MES1FISIMETA, NUM_MES2FISIMETA,NUM_MES3FISIMETA," +
                    "NUM_MES4FISIMETA, NUM_MES5FISIMETA, NUM_MES6FISIMETA," +
                    "NUM_MES7FISIMETA, NUM_MES8FISIMETA, NUM_MES9FISIMETA," +
                    "NUM_MES10FISIMETA, NUM_MES11FISIMETA, NUM_MES12FISIMETA from ME_FISIMETA";
            rs = stmt.executeQuery(sql);
            FisiMetaVO bean = null;
            while (rs.next()) {
                bean = new FisiMetaVO();   
                setFisiMeta(bean, rs);
                lista.add(bean);
            }

        } finally {
            if (rs != null) {
                rs.close();
                rs = null;
            }
            if (stmt != null) {
                stmt.close();
                stmt = null;
            }
            if (conn != null) {
                conn.close();
                conn = null;
            }

        }
        return lista;
    }
    
    
    
    
    
    
    



    public List getFiltro(int id) throws SQLException {
        PreparedStatement pstmt = null;
        Statement stmt = null;
        ResultSet rs = null;
        ArrayList<FisiMetaVO> lista = new ArrayList<FisiMetaVO>(0);
        //lista=null;
        String sql = "";
        try {
            conn = DriverManager.getConnection(url, usuario, password);
            sql = " select NUM_CODFISIMETA_PK,NUM_CODMETAAPER_PK,TX_TIPOFISIMETA,CASE WHEN NUM_MES1FISIMETA >= NUM_MES2FISIMETA AND NUM_MES1FISIMETA >= NUM_MES3FISIMETA AND NUM_MES1FISIMETA >= NUM_MES4FISIMETA AND NUM_MES1FISIMETA >= NUM_MES5FISIMETA AND NUM_MES1FISIMETA >= NUM_MES6FISIMETA AND NUM_MES1FISIMETA >= NUM_MES7FISIMETA AND NUM_MES1FISIMETA >= NUM_MES8FISIMETA AND NUM_MES1FISIMETA >= NUM_MES9FISIMETA AND NUM_MES1FISIMETA >= NUM_MES10FISIMETA AND NUM_MES1FISIMETA >= NUM_MES11FISIMETA AND NUM_MES1FISIMETA >= NUM_MES12FISIMETA THEN NUM_MES1FISIMETA " +
            		" WHEN NUM_MES2FISIMETA >= NUM_MES1FISIMETA AND NUM_MES2FISIMETA >= NUM_MES3FISIMETA AND NUM_MES2FISIMETA >= NUM_MES4FISIMETA AND NUM_MES2FISIMETA >= NUM_MES5FISIMETA AND NUM_MES2FISIMETA >= NUM_MES6FISIMETA AND NUM_MES2FISIMETA >= NUM_MES7FISIMETA AND NUM_MES2FISIMETA >= NUM_MES8FISIMETA AND NUM_MES2FISIMETA >= NUM_MES9FISIMETA AND NUM_MES2FISIMETA >= NUM_MES10FISIMETA AND NUM_MES2FISIMETA >= NUM_MES11FISIMETA AND NUM_MES2FISIMETA >= NUM_MES12FISIMETA THEN NUM_MES2FISIMETA " +
            		" WHEN NUM_MES3FISIMETA >= NUM_MES1FISIMETA AND NUM_MES3FISIMETA >= NUM_MES2FISIMETA AND NUM_MES3FISIMETA >= NUM_MES4FISIMETA AND NUM_MES3FISIMETA >= NUM_MES5FISIMETA AND NUM_MES3FISIMETA >= NUM_MES6FISIMETA AND NUM_MES3FISIMETA >= NUM_MES7FISIMETA AND NUM_MES3FISIMETA >= NUM_MES8FISIMETA AND NUM_MES3FISIMETA >= NUM_MES9FISIMETA AND NUM_MES3FISIMETA >= NUM_MES10FISIMETA AND NUM_MES3FISIMETA >= NUM_MES11FISIMETA AND NUM_MES3FISIMETA >= NUM_MES12FISIMETA THEN NUM_MES3FISIMETA " +
            		" WHEN NUM_MES4FISIMETA >= NUM_MES1FISIMETA AND NUM_MES4FISIMETA >= NUM_MES2FISIMETA AND NUM_MES4FISIMETA >= NUM_MES3FISIMETA AND NUM_MES4FISIMETA >= NUM_MES5FISIMETA AND NUM_MES4FISIMETA >= NUM_MES6FISIMETA AND NUM_MES4FISIMETA >= NUM_MES7FISIMETA AND NUM_MES4FISIMETA >= NUM_MES8FISIMETA AND NUM_MES4FISIMETA >= NUM_MES9FISIMETA AND NUM_MES4FISIMETA >= NUM_MES10FISIMETA AND NUM_MES4FISIMETA >= NUM_MES11FISIMETA AND NUM_MES4FISIMETA >= NUM_MES12FISIMETA THEN NUM_MES4FISIMETA " +
            		" WHEN NUM_MES5FISIMETA >= NUM_MES1FISIMETA AND NUM_MES5FISIMETA >= NUM_MES2FISIMETA AND NUM_MES5FISIMETA >= NUM_MES3FISIMETA AND NUM_MES5FISIMETA >= NUM_MES4FISIMETA AND NUM_MES5FISIMETA >= NUM_MES6FISIMETA AND NUM_MES5FISIMETA >= NUM_MES7FISIMETA AND NUM_MES5FISIMETA >= NUM_MES8FISIMETA AND NUM_MES5FISIMETA >= NUM_MES9FISIMETA AND NUM_MES5FISIMETA >= NUM_MES10FISIMETA AND NUM_MES5FISIMETA >= NUM_MES11FISIMETA AND NUM_MES5FISIMETA >= NUM_MES12FISIMETA THEN NUM_MES5FISIMETA " +
            		" WHEN NUM_MES6FISIMETA >= NUM_MES1FISIMETA AND NUM_MES6FISIMETA >= NUM_MES2FISIMETA AND NUM_MES6FISIMETA >= NUM_MES3FISIMETA AND NUM_MES6FISIMETA >= NUM_MES4FISIMETA AND NUM_MES6FISIMETA >= NUM_MES5FISIMETA AND NUM_MES6FISIMETA >= NUM_MES7FISIMETA AND NUM_MES6FISIMETA >= NUM_MES8FISIMETA AND NUM_MES6FISIMETA >= NUM_MES9FISIMETA AND NUM_MES6FISIMETA >= NUM_MES10FISIMETA AND NUM_MES6FISIMETA >= NUM_MES11FISIMETA AND NUM_MES6FISIMETA >= NUM_MES12FISIMETA THEN NUM_MES6FISIMETA " +
            		" WHEN NUM_MES7FISIMETA >= NUM_MES1FISIMETA AND NUM_MES7FISIMETA >= NUM_MES2FISIMETA AND NUM_MES7FISIMETA >= NUM_MES3FISIMETA AND NUM_MES7FISIMETA >= NUM_MES4FISIMETA AND NUM_MES7FISIMETA >= NUM_MES5FISIMETA AND NUM_MES7FISIMETA >= NUM_MES6FISIMETA AND NUM_MES7FISIMETA >= NUM_MES8FISIMETA AND NUM_MES7FISIMETA >= NUM_MES9FISIMETA AND NUM_MES7FISIMETA >= NUM_MES10FISIMETA AND NUM_MES7FISIMETA >= NUM_MES11FISIMETA AND NUM_MES7FISIMETA >= NUM_MES12FISIMETA THEN NUM_MES7FISIMETA " +
            		" WHEN NUM_MES8FISIMETA >= NUM_MES1FISIMETA AND NUM_MES8FISIMETA >= NUM_MES2FISIMETA AND NUM_MES8FISIMETA >= NUM_MES3FISIMETA AND NUM_MES8FISIMETA >= NUM_MES4FISIMETA AND NUM_MES8FISIMETA >= NUM_MES5FISIMETA AND NUM_MES8FISIMETA >= NUM_MES6FISIMETA AND NUM_MES8FISIMETA >= NUM_MES7FISIMETA AND NUM_MES8FISIMETA >= NUM_MES9FISIMETA AND NUM_MES8FISIMETA >= NUM_MES10FISIMETA AND NUM_MES8FISIMETA >= NUM_MES11FISIMETA AND NUM_MES8FISIMETA >= NUM_MES12FISIMETA THEN NUM_MES8FISIMETA " +
            		" WHEN NUM_MES9FISIMETA >= NUM_MES1FISIMETA AND NUM_MES9FISIMETA >= NUM_MES2FISIMETA AND NUM_MES9FISIMETA >= NUM_MES3FISIMETA AND NUM_MES9FISIMETA >= NUM_MES4FISIMETA AND NUM_MES9FISIMETA >= NUM_MES5FISIMETA AND NUM_MES9FISIMETA >= NUM_MES6FISIMETA AND NUM_MES9FISIMETA >= NUM_MES7FISIMETA AND NUM_MES9FISIMETA >= NUM_MES8FISIMETA AND NUM_MES9FISIMETA >= NUM_MES10FISIMETA AND NUM_MES9FISIMETA >= NUM_MES11FISIMETA AND NUM_MES9FISIMETA >= NUM_MES12FISIMETA THEN NUM_MES9FISIMETA " +
            		" WHEN NUM_MES10FISIMETA >= NUM_MES1FISIMETA AND NUM_MES10FISIMETA >= NUM_MES2FISIMETA AND NUM_MES10FISIMETA >= NUM_MES3FISIMETA AND NUM_MES10FISIMETA >= NUM_MES4FISIMETA AND NUM_MES10FISIMETA >= NUM_MES5FISIMETA AND NUM_MES10FISIMETA >= NUM_MES6FISIMETA AND NUM_MES10FISIMETA >= NUM_MES7FISIMETA AND NUM_MES10FISIMETA >= NUM_MES8FISIMETA AND NUM_MES10FISIMETA >= NUM_MES9FISIMETA AND NUM_MES10FISIMETA >= NUM_MES11FISIMETA AND NUM_MES10FISIMETA >= NUM_MES12FISIMETA THEN NUM_MES10FISIMETA " +
            		" WHEN NUM_MES11FISIMETA >= NUM_MES1FISIMETA AND NUM_MES11FISIMETA >= NUM_MES2FISIMETA AND NUM_MES11FISIMETA >= NUM_MES3FISIMETA AND NUM_MES11FISIMETA >= NUM_MES4FISIMETA AND NUM_MES11FISIMETA >= NUM_MES5FISIMETA AND NUM_MES11FISIMETA >= NUM_MES6FISIMETA AND NUM_MES11FISIMETA >= NUM_MES7FISIMETA AND NUM_MES11FISIMETA >= NUM_MES8FISIMETA AND NUM_MES11FISIMETA >= NUM_MES9FISIMETA AND NUM_MES11FISIMETA >= NUM_MES10FISIMETA AND NUM_MES11FISIMETA >= NUM_MES12FISIMETA THEN NUM_MES11FISIMETA " +
            		" ELSE NUM_MES12FISIMETA END AS mayor, NUM_MES1FISIMETA, NUM_MES2FISIMETA,NUM_MES3FISIMETA,NUM_MES4FISIMETA, NUM_MES5FISIMETA, NUM_MES6FISIMETA,NUM_MES7FISIMETA, NUM_MES8FISIMETA, NUM_MES9FISIMETA,NUM_MES10FISIMETA, NUM_MES11FISIMETA, NUM_MES12FISIMETA from ME_FISIMETA where TX_TIPOFISIMETA=2 and NUM_CODMETAAPER_PK=? " +
            		" UNION " +
            		"select NUM_CODFISIMETA_PK,NUM_CODMETAAPER_PK,TX_TIPOFISIMETA,(  NUM_MES1FISIMETA +NUM_MES2FISIMETA+NUM_MES3FISIMETA+NUM_MES4FISIMETA+ NUM_MES5FISIMETA+NUM_MES6FISIMETA+NUM_MES7FISIMETA +NUM_MES8FISIMETA+NUM_MES9FISIMETA+NUM_MES10FISIMETA+NUM_MES11FISIMETA+NUM_MES12FISIMETA) as mayor, NUM_MES1FISIMETA, NUM_MES2FISIMETA,NUM_MES3FISIMETA,NUM_MES4FISIMETA, NUM_MES5FISIMETA, NUM_MES6FISIMETA,NUM_MES7FISIMETA, NUM_MES8FISIMETA, NUM_MES9FISIMETA,NUM_MES10FISIMETA, NUM_MES11FISIMETA, NUM_MES12FISIMETA from ME_FISIMETA where TX_TIPOFISIMETA=1 and NUM_CODMETAAPER_PK=? ";
            pstmt = conn.prepareStatement(sql);
            pstmt.setInt(1, id);
            pstmt.setInt(2, id);
            rs = pstmt.executeQuery();
            FisiMetaVO bean = null;
            while (rs.next()) {
                bean = new FisiMetaVO();
                setFisiMeta1(bean, rs);
                lista.add(bean);
            }
            rs.close();
            pstmt.close();
        } finally {
            if (rs != null) {
                rs.close();
                rs = null;
            }
            if (stmt != null) {
                stmt.close();
                stmt = null;
            }
            if (conn != null) {
                conn.close();
                conn = null;
            }

        }
        return lista;
    }




    public int getMuestrafin(int id) throws SQLException {
        PreparedStatement pstmt = null;
        Statement stmt = null;
        ResultSet rs = null;
        ArrayList<FisiMetaVO> lista = new ArrayList<FisiMetaVO>(0);
        int numero=0;
        //lista=null;
        String sql = "";
        try {
            conn = DriverManager.getConnection(url, usuario, password);
            sql = "select NUM_CODFISIMETA_PK from ME_FISIMETA WHERE NUM_CODMETAAPER_PK=?";
            pstmt = conn.prepareStatement(sql);
            pstmt.setInt(1, id);
            rs = pstmt.executeQuery();
            FisiMetaVO bean = null;
            while (rs.next()) {
                bean = new FisiMetaVO();
                setMuestraF(bean, rs);
                lista.add(bean);
                numero=1;
            }
            rs.close();
            pstmt.close();
        } finally {
            if (rs != null) {
                rs.close();
                rs = null;
            }
            if (stmt != null) {
                stmt.close();
                stmt = null;
            }
            if (conn != null) {
                conn.close();
                conn = null;
            }

        }
        return numero;
    }

    public int getMuestrafinMod(int id) throws SQLException {
        PreparedStatement pstmt = null;
        Statement stmt = null;
        ResultSet rs = null;
        ArrayList<FisiMetaVO> lista = new ArrayList<FisiMetaVO>(0);
        int numero=0;
        //lista=null;
        String sql = "";
        try {
            conn = DriverManager.getConnection(url, usuario, password);
            sql = "select NUM_CODFISIMETAM_PK from ME_FISIMETAM WHERE NUM_CODMETAAPER_PK=?";
            pstmt = conn.prepareStatement(sql);
            pstmt.setInt(1, id);
            rs = pstmt.executeQuery();
            FisiMetaVO bean = null;
            while (rs.next()) {
                bean = new FisiMetaVO();
                setMuestraFM(bean, rs);
                lista.add(bean);
                numero=1;
            }
            rs.close();
            pstmt.close();
        } finally {
            if (rs != null) {
                rs.close();
                rs = null;
            }
            if (stmt != null) {
                stmt.close();
                stmt = null;
            }
            if (conn != null) {
                conn.close();
                conn = null;
            }

        }
        return numero;
    }




    public List getFiltroM(int id) throws SQLException {
        PreparedStatement pstmt = null;
        Statement stmt = null;
        ResultSet rs = null;
        ArrayList<FisiMetaMVO> lista = new ArrayList<FisiMetaMVO>(0);
        //lista=null;
        String sql = "";
        try {
            conn = DriverManager.getConnection(url, usuario, password);
            sql = " select NUM_CODFISIMETAM_PK,NUM_CODMETAAPER_PK,TX_TIPOFISIMETAM,CASE WHEN NUM_MES1FISIMETAM >= NUM_MES2FISIMETAM AND NUM_MES1FISIMETAM >= NUM_MES3FISIMETAM AND NUM_MES1FISIMETAM >= NUM_MES4FISIMETAM AND NUM_MES1FISIMETAM >= NUM_MES5FISIMETAM AND NUM_MES1FISIMETAM >= NUM_MES6FISIMETAM AND NUM_MES1FISIMETAM >= NUM_MES7FISIMETAM AND NUM_MES1FISIMETAM >= NUM_MES8FISIMETAM AND NUM_MES1FISIMETAM >= NUM_MES9FISIMETAM AND NUM_MES1FISIMETAM >= NUM_MES10FISIMETAM AND NUM_MES1FISIMETAM >= NUM_MES11FISIMETAM AND NUM_MES1FISIMETAM >= NUM_MES12FISIMETAM THEN NUM_MES1FISIMETAM " +
            		" WHEN NUM_MES2FISIMETAM >= NUM_MES1FISIMETAM AND NUM_MES2FISIMETAM >= NUM_MES3FISIMETAM AND NUM_MES2FISIMETAM >= NUM_MES4FISIMETAM AND NUM_MES2FISIMETAM >= NUM_MES5FISIMETAM AND NUM_MES2FISIMETAM >= NUM_MES6FISIMETAM AND NUM_MES2FISIMETAM >= NUM_MES7FISIMETAM AND NUM_MES2FISIMETAM >= NUM_MES8FISIMETAM AND NUM_MES2FISIMETAM >= NUM_MES9FISIMETAM AND NUM_MES2FISIMETAM >= NUM_MES10FISIMETAM AND NUM_MES2FISIMETAM >= NUM_MES11FISIMETAM AND NUM_MES2FISIMETAM >= NUM_MES12FISIMETAM THEN NUM_MES2FISIMETAM " +
            		" WHEN NUM_MES3FISIMETAM >= NUM_MES1FISIMETAM AND NUM_MES3FISIMETAM >= NUM_MES2FISIMETAM AND NUM_MES3FISIMETAM >= NUM_MES4FISIMETAM AND NUM_MES3FISIMETAM >= NUM_MES5FISIMETAM AND NUM_MES3FISIMETAM >= NUM_MES6FISIMETAM AND NUM_MES3FISIMETAM >= NUM_MES7FISIMETAM AND NUM_MES3FISIMETAM >= NUM_MES8FISIMETAM AND NUM_MES3FISIMETAM >= NUM_MES9FISIMETAM AND NUM_MES3FISIMETAM >= NUM_MES10FISIMETAM AND NUM_MES3FISIMETAM >= NUM_MES11FISIMETAM AND NUM_MES3FISIMETAM >= NUM_MES12FISIMETAM THEN NUM_MES3FISIMETAM " +
            		" WHEN NUM_MES4FISIMETAM >= NUM_MES1FISIMETAM AND NUM_MES4FISIMETAM >= NUM_MES2FISIMETAM AND NUM_MES4FISIMETAM >= NUM_MES3FISIMETAM AND NUM_MES4FISIMETAM >= NUM_MES5FISIMETAM AND NUM_MES4FISIMETAM >= NUM_MES6FISIMETAM AND NUM_MES4FISIMETAM >= NUM_MES7FISIMETAM AND NUM_MES4FISIMETAM >= NUM_MES8FISIMETAM AND NUM_MES4FISIMETAM >= NUM_MES9FISIMETAM AND NUM_MES4FISIMETAM >= NUM_MES10FISIMETAM AND NUM_MES4FISIMETAM >= NUM_MES11FISIMETAM AND NUM_MES4FISIMETAM >= NUM_MES12FISIMETAM THEN NUM_MES4FISIMETAM " +
            		" WHEN NUM_MES5FISIMETAM >= NUM_MES1FISIMETAM AND NUM_MES5FISIMETAM >= NUM_MES2FISIMETAM AND NUM_MES5FISIMETAM >= NUM_MES3FISIMETAM AND NUM_MES5FISIMETAM >= NUM_MES4FISIMETAM AND NUM_MES5FISIMETAM >= NUM_MES6FISIMETAM AND NUM_MES5FISIMETAM >= NUM_MES7FISIMETAM AND NUM_MES5FISIMETAM >= NUM_MES8FISIMETAM AND NUM_MES5FISIMETAM >= NUM_MES9FISIMETAM AND NUM_MES5FISIMETAM >= NUM_MES10FISIMETAM AND NUM_MES5FISIMETAM >= NUM_MES11FISIMETAM AND NUM_MES5FISIMETAM >= NUM_MES12FISIMETAM THEN NUM_MES5FISIMETAM " +
            		" WHEN NUM_MES6FISIMETAM >= NUM_MES1FISIMETAM AND NUM_MES6FISIMETAM >= NUM_MES2FISIMETAM AND NUM_MES6FISIMETAM >= NUM_MES3FISIMETAM AND NUM_MES6FISIMETAM >= NUM_MES4FISIMETAM AND NUM_MES6FISIMETAM >= NUM_MES5FISIMETAM AND NUM_MES6FISIMETAM >= NUM_MES7FISIMETAM AND NUM_MES6FISIMETAM >= NUM_MES8FISIMETAM AND NUM_MES6FISIMETAM >= NUM_MES9FISIMETAM AND NUM_MES6FISIMETAM >= NUM_MES10FISIMETAM AND NUM_MES6FISIMETAM >= NUM_MES11FISIMETAM AND NUM_MES6FISIMETAM >= NUM_MES12FISIMETAM THEN NUM_MES6FISIMETAM " +
            		" WHEN NUM_MES7FISIMETAM >= NUM_MES1FISIMETAM AND NUM_MES7FISIMETAM >= NUM_MES2FISIMETAM AND NUM_MES7FISIMETAM >= NUM_MES3FISIMETAM AND NUM_MES7FISIMETAM >= NUM_MES4FISIMETAM AND NUM_MES7FISIMETAM >= NUM_MES5FISIMETAM AND NUM_MES7FISIMETAM >= NUM_MES6FISIMETAM AND NUM_MES7FISIMETAM >= NUM_MES8FISIMETAM AND NUM_MES7FISIMETAM >= NUM_MES9FISIMETAM AND NUM_MES7FISIMETAM >= NUM_MES10FISIMETAM AND NUM_MES7FISIMETAM >= NUM_MES11FISIMETAM AND NUM_MES7FISIMETAM >= NUM_MES12FISIMETAM THEN NUM_MES7FISIMETAM " +
            		" WHEN NUM_MES8FISIMETAM >= NUM_MES1FISIMETAM AND NUM_MES8FISIMETAM >= NUM_MES2FISIMETAM AND NUM_MES8FISIMETAM >= NUM_MES3FISIMETAM AND NUM_MES8FISIMETAM >= NUM_MES4FISIMETAM AND NUM_MES8FISIMETAM >= NUM_MES5FISIMETAM AND NUM_MES8FISIMETAM >= NUM_MES6FISIMETAM AND NUM_MES8FISIMETAM >= NUM_MES7FISIMETAM AND NUM_MES8FISIMETAM >= NUM_MES9FISIMETAM AND NUM_MES8FISIMETAM >= NUM_MES10FISIMETAM AND NUM_MES8FISIMETAM >= NUM_MES11FISIMETAM AND NUM_MES8FISIMETAM >= NUM_MES12FISIMETAM THEN NUM_MES8FISIMETAM " +
            		" WHEN NUM_MES9FISIMETAM >= NUM_MES1FISIMETAM AND NUM_MES9FISIMETAM >= NUM_MES2FISIMETAM AND NUM_MES9FISIMETAM >= NUM_MES3FISIMETAM AND NUM_MES9FISIMETAM >= NUM_MES4FISIMETAM AND NUM_MES9FISIMETAM >= NUM_MES5FISIMETAM AND NUM_MES9FISIMETAM >= NUM_MES6FISIMETAM AND NUM_MES9FISIMETAM >= NUM_MES7FISIMETAM AND NUM_MES9FISIMETAM >= NUM_MES8FISIMETAM AND NUM_MES9FISIMETAM >= NUM_MES10FISIMETAM AND NUM_MES9FISIMETAM >= NUM_MES11FISIMETAM AND NUM_MES9FISIMETAM >= NUM_MES12FISIMETAM THEN NUM_MES9FISIMETAM " +
            		" WHEN NUM_MES10FISIMETAM >= NUM_MES1FISIMETAM AND NUM_MES10FISIMETAM >= NUM_MES2FISIMETAM AND NUM_MES10FISIMETAM >= NUM_MES3FISIMETAM AND NUM_MES10FISIMETAM >= NUM_MES4FISIMETAM AND NUM_MES10FISIMETAM >= NUM_MES5FISIMETAM AND NUM_MES10FISIMETAM >= NUM_MES6FISIMETAM AND NUM_MES10FISIMETAM >= NUM_MES7FISIMETAM AND NUM_MES10FISIMETAM >= NUM_MES8FISIMETAM AND NUM_MES10FISIMETAM >= NUM_MES9FISIMETAM AND NUM_MES10FISIMETAM >= NUM_MES11FISIMETAM AND NUM_MES10FISIMETAM >= NUM_MES12FISIMETAM THEN NUM_MES10FISIMETAM " +
            		" WHEN NUM_MES11FISIMETAM >= NUM_MES1FISIMETAM AND NUM_MES11FISIMETAM >= NUM_MES2FISIMETAM AND NUM_MES11FISIMETAM >= NUM_MES3FISIMETAM AND NUM_MES11FISIMETAM >= NUM_MES4FISIMETAM AND NUM_MES11FISIMETAM >= NUM_MES5FISIMETAM AND NUM_MES11FISIMETAM >= NUM_MES6FISIMETAM AND NUM_MES11FISIMETAM >= NUM_MES7FISIMETAM AND NUM_MES11FISIMETAM >= NUM_MES8FISIMETAM AND NUM_MES11FISIMETAM >= NUM_MES9FISIMETAM AND NUM_MES11FISIMETAM >= NUM_MES10FISIMETAM AND NUM_MES11FISIMETAM >= NUM_MES12FISIMETAM THEN NUM_MES11FISIMETAM " +
            		" ELSE NUM_MES12FISIMETAM END AS mayor, NUM_MES1FISIMETAM, NUM_MES2FISIMETAM,NUM_MES3FISIMETAM,NUM_MES4FISIMETAM, NUM_MES5FISIMETAM, NUM_MES6FISIMETAM,NUM_MES7FISIMETAM, NUM_MES8FISIMETAM, NUM_MES9FISIMETAM,NUM_MES10FISIMETAM, NUM_MES11FISIMETAM, NUM_MES12FISIMETAM from ME_FISIMETAM where TX_TIPOFISIMETAM=2 and NUM_CODMETAAPER_PK=? " +
            		" UNION " +
            		"select NUM_CODFISIMETAM_PK,NUM_CODMETAAPER_PK,TX_TIPOFISIMETAM,(  NUM_MES1FISIMETAM +NUM_MES2FISIMETAM+NUM_MES3FISIMETAM+NUM_MES4FISIMETAM+ NUM_MES5FISIMETAM+NUM_MES6FISIMETAM+NUM_MES7FISIMETAM +NUM_MES8FISIMETAM+NUM_MES9FISIMETAM+NUM_MES10FISIMETAM+NUM_MES11FISIMETAM+NUM_MES12FISIMETAM) as mayor, NUM_MES1FISIMETAM, NUM_MES2FISIMETAM,NUM_MES3FISIMETAM,NUM_MES4FISIMETAM, NUM_MES5FISIMETAM, NUM_MES6FISIMETAM,NUM_MES7FISIMETAM, NUM_MES8FISIMETAM, NUM_MES9FISIMETAM,NUM_MES10FISIMETAM, NUM_MES11FISIMETAM, NUM_MES12FISIMETAM from ME_FISIMETAM where TX_TIPOFISIMETAM=1 and NUM_CODMETAAPER_PK=? ";
            pstmt = conn.prepareStatement(sql);
            pstmt.setInt(1, id);
            pstmt.setInt(2, id);
            rs = pstmt.executeQuery();
            FisiMetaMVO bean = null;
            while (rs.next()) {
                bean = new FisiMetaMVO();
                setFisiMeta2(bean, rs);
                lista.add(bean);
            }
            rs.close();
            pstmt.close();
        } finally {
            if (rs != null) {
                rs.close();
                rs = null;
            }
            if (stmt != null) {
                stmt.close();
                stmt = null;
            }
            if (conn != null) {
                conn.close();
                conn = null;
            }

        }
        return lista;
    }
    
    
    
    
    
    
    
    
    
    
    
    /*public List getFiltrodos(int id) throws SQLException {
        PreparedStatement pstmt = null;
        Statement stmt = null;
        ResultSet rs = null;
        ArrayList<FisiMetaVO> lista = new ArrayList<FisiMetaVO>(0);
        //lista=null;
        String sql = "";
        try {
            conn = DriverManager.getConnection(url, usuario, password);
            sql = "select NUM_CODFISIMETA_PK,NUM_CODMETAAPER_PK,COD_TIPOFISIMETA_PK,CASE " +
            		"WHEN NUM_MES1FISIMETA >= NUM_MES2FISIMETA AND NUM_MES1FISIMETA >= NUM_MES3FISIMETA AND NUM_MES1FISIMETA >= NUM_MES4FISIMETA AND NUM_MES1FISIMETA >= NUM_MES5FISIMETA AND NUM_MES1FISIMETA >= NUM_MES6FISIMETA AND NUM_MES1FISIMETA >= NUM_MES7FISIMETA AND NUM_MES1FISIMETA >= NUM_MES8FISIMETA AND NUM_MES1FISIMETA >= NUM_MES9FISIMETA AND NUM_MES1FISIMETA >= NUM_MES10FISIMETA AND NUM_MES1FISIMETA >= NUM_MES11FISIMETA AND NUM_MES1FISIMETA >= NUM_MES12FISIMETA THEN NUM_MES1FISIMETA " +
            		"WHEN NUM_MES2FISIMETA >= NUM_MES1FISIMETA AND NUM_MES2FISIMETA >= NUM_MES3FISIMETA AND NUM_MES2FISIMETA >= NUM_MES4FISIMETA AND NUM_MES2FISIMETA >= NUM_MES5FISIMETA AND NUM_MES2FISIMETA >= NUM_MES6FISIMETA AND NUM_MES2FISIMETA >= NUM_MES7FISIMETA AND NUM_MES2FISIMETA >= NUM_MES8FISIMETA AND NUM_MES2FISIMETA >= NUM_MES9FISIMETA AND NUM_MES2FISIMETA >= NUM_MES10FISIMETA AND NUM_MES2FISIMETA >= NUM_MES11FISIMETA AND NUM_MES2FISIMETA >= NUM_MES12FISIMETA THEN NUM_MES2FISIMETA " +
            		"WHEN NUM_MES3FISIMETA >= NUM_MES1FISIMETA AND NUM_MES3FISIMETA >= NUM_MES2FISIMETA AND NUM_MES3FISIMETA >= NUM_MES4FISIMETA AND NUM_MES3FISIMETA >= NUM_MES5FISIMETA AND NUM_MES3FISIMETA >= NUM_MES6FISIMETA AND NUM_MES3FISIMETA >= NUM_MES7FISIMETA AND NUM_MES3FISIMETA >= NUM_MES8FISIMETA AND NUM_MES3FISIMETA >= NUM_MES9FISIMETA AND NUM_MES3FISIMETA >= NUM_MES10FISIMETA AND NUM_MES3FISIMETA >= NUM_MES11FISIMETA AND NUM_MES3FISIMETA >= NUM_MES12FISIMETA THEN NUM_MES3FISIMETA " +
            		"WHEN NUM_MES4FISIMETA >= NUM_MES1FISIMETA AND NUM_MES4FISIMETA >= NUM_MES2FISIMETA AND NUM_MES4FISIMETA >= NUM_MES3FISIMETA AND NUM_MES4FISIMETA >= NUM_MES5FISIMETA AND NUM_MES4FISIMETA >= NUM_MES6FISIMETA AND NUM_MES4FISIMETA >= NUM_MES7FISIMETA AND NUM_MES4FISIMETA >= NUM_MES8FISIMETA AND NUM_MES4FISIMETA >= NUM_MES9FISIMETA AND NUM_MES4FISIMETA >= NUM_MES10FISIMETA AND NUM_MES4FISIMETA >= NUM_MES11FISIMETA AND NUM_MES4FISIMETA >= NUM_MES12FISIMETA THEN NUM_MES4FISIMETA " +
            		"WHEN NUM_MES5FISIMETA >= NUM_MES1FISIMETA AND NUM_MES5FISIMETA >= NUM_MES2FISIMETA AND NUM_MES5FISIMETA >= NUM_MES3FISIMETA AND NUM_MES5FISIMETA >= NUM_MES4FISIMETA AND NUM_MES5FISIMETA >= NUM_MES6FISIMETA AND NUM_MES5FISIMETA >= NUM_MES7FISIMETA AND NUM_MES5FISIMETA >= NUM_MES8FISIMETA AND NUM_MES5FISIMETA >= NUM_MES9FISIMETA AND NUM_MES5FISIMETA >= NUM_MES10FISIMETA AND NUM_MES5FISIMETA >= NUM_MES11FISIMETA AND NUM_MES5FISIMETA >= NUM_MES12FISIMETA THEN NUM_MES5FISIMETA " +
            		"WHEN NUM_MES6FISIMETA >= NUM_MES1FISIMETA AND NUM_MES6FISIMETA >= NUM_MES2FISIMETA AND NUM_MES6FISIMETA >= NUM_MES3FISIMETA AND NUM_MES6FISIMETA >= NUM_MES4FISIMETA AND NUM_MES6FISIMETA >= NUM_MES5FISIMETA AND NUM_MES6FISIMETA >= NUM_MES7FISIMETA AND NUM_MES6FISIMETA >= NUM_MES8FISIMETA AND NUM_MES6FISIMETA >= NUM_MES9FISIMETA AND NUM_MES6FISIMETA >= NUM_MES10FISIMETA AND NUM_MES6FISIMETA >= NUM_MES11FISIMETA AND NUM_MES6FISIMETA >= NUM_MES12FISIMETA THEN NUM_MES6FISIMETA " +
            		"WHEN NUM_MES7FISIMETA >= NUM_MES1FISIMETA AND NUM_MES7FISIMETA >= NUM_MES2FISIMETA AND NUM_MES7FISIMETA >= NUM_MES3FISIMETA AND NUM_MES7FISIMETA >= NUM_MES4FISIMETA AND NUM_MES7FISIMETA >= NUM_MES5FISIMETA AND NUM_MES7FISIMETA >= NUM_MES6FISIMETA AND NUM_MES7FISIMETA >= NUM_MES8FISIMETA AND NUM_MES7FISIMETA >= NUM_MES9FISIMETA AND NUM_MES7FISIMETA >= NUM_MES10FISIMETA AND NUM_MES7FISIMETA >= NUM_MES11FISIMETA AND NUM_MES7FISIMETA >= NUM_MES12FISIMETA THEN NUM_MES7FISIMETA " +
            		"WHEN NUM_MES8FISIMETA >= NUM_MES1FISIMETA AND NUM_MES8FISIMETA >= NUM_MES2FISIMETA AND NUM_MES8FISIMETA >= NUM_MES3FISIMETA AND NUM_MES8FISIMETA >= NUM_MES4FISIMETA AND NUM_MES8FISIMETA >= NUM_MES5FISIMETA AND NUM_MES8FISIMETA >= NUM_MES6FISIMETA AND NUM_MES8FISIMETA >= NUM_MES7FISIMETA AND NUM_MES8FISIMETA >= NUM_MES9FISIMETA AND NUM_MES8FISIMETA >= NUM_MES10FISIMETA AND NUM_MES8FISIMETA >= NUM_MES11FISIMETA AND NUM_MES8FISIMETA >= NUM_MES12FISIMETA THEN NUM_MES8FISIMETA " +
            		"WHEN NUM_MES9FISIMETA >= NUM_MES1FISIMETA AND NUM_MES9FISIMETA >= NUM_MES2FISIMETA AND NUM_MES9FISIMETA >= NUM_MES3FISIMETA AND NUM_MES9FISIMETA >= NUM_MES4FISIMETA AND NUM_MES9FISIMETA >= NUM_MES5FISIMETA AND NUM_MES9FISIMETA >= NUM_MES6FISIMETA AND NUM_MES9FISIMETA >= NUM_MES7FISIMETA AND NUM_MES9FISIMETA >= NUM_MES8FISIMETA AND NUM_MES9FISIMETA >= NUM_MES10FISIMETA AND NUM_MES9FISIMETA >= NUM_MES11FISIMETA AND NUM_MES9FISIMETA >= NUM_MES12FISIMETA THEN NUM_MES9FISIMETA " +
            		"WHEN NUM_MES10FISIMETA >= NUM_MES1FISIMETA AND NUM_MES10FISIMETA >= NUM_MES2FISIMETA AND NUM_MES10FISIMETA >= NUM_MES3FISIMETA AND NUM_MES10FISIMETA >= NUM_MES4FISIMETA AND NUM_MES10FISIMETA >= NUM_MES5FISIMETA AND NUM_MES10FISIMETA >= NUM_MES6FISIMETA AND NUM_MES10FISIMETA >= NUM_MES7FISIMETA AND NUM_MES10FISIMETA >= NUM_MES8FISIMETA AND NUM_MES10FISIMETA >= NUM_MES9FISIMETA AND NUM_MES10FISIMETA >= NUM_MES11FISIMETA AND NUM_MES10FISIMETA >= NUM_MES12FISIMETA THEN NUM_MES10FISIMETA " +
            		"WHEN NUM_MES11FISIMETA >= NUM_MES1FISIMETA AND NUM_MES11FISIMETA >= NUM_MES2FISIMETA AND NUM_MES11FISIMETA >= NUM_MES3FISIMETA AND NUM_MES11FISIMETA >= NUM_MES4FISIMETA AND NUM_MES11FISIMETA >= NUM_MES5FISIMETA AND NUM_MES11FISIMETA >= NUM_MES6FISIMETA AND NUM_MES11FISIMETA >= NUM_MES7FISIMETA AND NUM_MES11FISIMETA >= NUM_MES8FISIMETA AND NUM_MES11FISIMETA >= NUM_MES9FISIMETA AND NUM_MES11FISIMETA >= NUM_MES10FISIMETA AND NUM_MES11FISIMETA >= NUM_MES12FISIMETA THEN NUM_MES11FISIMETA " +
            		"ELSE NUM_MES12FISIMETA END AS mayor, NUM_MES1FISIMETA, NUM_MES2FISIMETA,NUM_MES3FISIMETA,NUM_MES4FISIMETA, NUM_MES5FISIMETA, NUM_MES6FISIMETA,NUM_MES7FISIMETA, NUM_MES8FISIMETA, NUM_MES9FISIMETA,NUM_MES10FISIMETA, NUM_MES11FISIMETA, NUM_MES12FISIMETA from ME_FISIMETA where COD_TIPOFISIMETA_PK=?";
            pstmt = conn.prepareStatement(sql);
            pstmt.setInt(1, id);
            rs = pstmt.executeQuery();
            FisiMetaVO bean = null;
            while (rs.next()) {
                bean = new FisiMetaVO();
                setFisiMeta2(bean, rs);
                lista.add(bean);
            }
            rs.close();
            pstmt.close();
        } finally {
            if (rs != null) {
                rs.close();
                rs = null;
            }
            if (stmt != null) {
                stmt.close();
                stmt = null;
            }
            if (conn != null) {
                conn.close();
                conn = null;
            }

        }
        return lista;
    }*/


   /*   public OEstrategicoVO selectById(int id) throws SQLException {
        PreparedStatement pstmt = null;
        ResultSet rs = null;
        Connection conn = null;
        OEstrategicoVO bean = null;
        try {
            conn = DriverManager.getConnection(url, usuario, password);
            String sql = "select NUM_CODOBJ_PK,TX_DESCOBJ from ME_OBJ where NUM_CODOBJ_PK=?";
            pstmt = conn.prepareStatement(sql);
            pstmt.setInt(1, id);
            rs = pstmt.executeQuery();
            bean = new OEstrategicoVO();
            if (rs.next()) {
                setOEstrategico(bean, rs);
            }
            rs.close();
            pstmt.close();
        } finally {
            if (rs != null) {
                rs.close();
                rs = null;
            }
            if (pstmt != null) {
                pstmt.close();
                pstmt = null;
            }
            if (conn != null) {
                conn.close();
                conn = null;
            }
        }

        return bean;
    }
    *
    *
    */

}
